import axios from '../index';

const FILE_LIST_URL = 'file/detail';
const FILE_ADD_URL = 'file/add';
const BATCH_ADD_FILE = 'file/batchAdd';
const FILE_DETAIL_URL = 'file/detail';
const FILE_MODIFY_URL = 'file/update';
const VERSIONS_URL = 'file/version/list';
const VERSION_ADD_URL = 'file/version/add';
const VERSION_VIEW_URL = 'file/version/view';
const VERSION_DELETE_URL = 'file/version/delete';
const SHARE_ADD_URL = 'file/share/add';
const SHARE_LIST_URL = 'file/share/list';
const SHARE_MODIFY_URL = 'file/share/update';
const SHARE_DELETE_URL = 'file/share/delete';
const WEAPP_QRCODE = 'system/xcxQrCode';
const FILE_COMMENT_LIST_URL = 'comments/list';
const FILE_COMMENT_ADD_URL = 'comments/addcomments';
const FILE_DETAIL_SHARE_LIST_URL = 'file/share/list';
const FILE_DETAIL_SHARE_OPERATE_RECORDS_URL = 'record/list';
const SHARE_VIEW = 'file/share/view';
const FILE_DELETE_URL = 'file/delete';
const FILE_REFRESH_URL = 'file/share/version/refresh';
const FILE_FIND = 'file/find';
const SHARE_STATUS= 'file/share/status/get';
const VERTION_ACTIVE = 'file/version/activeId/get';

const COMPANY_TYPE = 'enterprise/company/type/list';//主体类型列表
const PARTNER_TYPE = 'enterprise/partner/type/list';//合伙类型列表
const ACCOUNT_TYPE = 'enterprise/bankAccount/type/list';//账户类型列表 募集户/..
const WORK_PROESS = 'enterprise/company/progress/list'; //主体工作进展
const STATUS_LIST = 'enterprise/company/status/list';//状态列表 正常、注销..
const QUERY_MAIN = 'enterprise/company/query';//分页查询主体
const ADD_MANAGE = 'enterprise/company/add';//添加主体

async function getFileList (id) {
  const response = await axios.post(FILE_LIST_URL, {
    s: id,
  });
  return response;
}

async function addFileOrFolder (params) {
  const response = await axios.post(FILE_ADD_URL, params);
  return response;
}

async function batchUploadFile (params) {
  const response = await axios.post(BATCH_ADD_FILE, params);
  return response;
}

async function getDetailInfo (id) {
  const response = await axios.post(FILE_DETAIL_URL, { s: id });
  return response;
}

async function modifyFile (params) {
  const response = await axios.post(FILE_MODIFY_URL, params);
  return response;
}

async function getVersionList (id) {
  const response = await axios.post(VERSIONS_URL, { s: id });
  return response;
}

async function addVersion (params) {
  const response = await axios.post(VERSION_ADD_URL, params);
  return response;
}

async function getFileByVersion (params) {
  const response = await axios.post(VERSION_VIEW_URL, params);
  return response;
}

// async function deleteFile () {}

async function deleteVersion (params) {
  const response = await axios.post(VERSION_DELETE_URL, params);
  return response;
}

async function addShare (params) {
  const response = await axios.post(SHARE_ADD_URL, params);
  return response;
}

async function getShareList (params) {
  const response = await axios.post(SHARE_LIST_URL, params);
  return response;
}

async function modifyShare (params) {
  const response = await axios.post(SHARE_MODIFY_URL, params);
  return response;
}

async function deleteShare (shareId) {
  const response = await axios.post(SHARE_DELETE_URL, { s: shareId });
  return response;
}

async function getWeappQRCode (shareId) {
  const response = await axios.get(WEAPP_QRCODE, {
    params: {
      shareId,
    },
  });
  return response;
}

async function getComments (fileId) {
  const response = await axios.post(FILE_COMMENT_LIST_URL, { s: fileId });
  return response;
}

async function addComment (params) {
  const response = await axios.post(FILE_COMMENT_ADD_URL, params);
  return response;
}

async function getShareListOfSpecifiedFile (params) {
  const response = await axios.post(FILE_DETAIL_SHARE_LIST_URL, params);
  return response;
}

async function getOperateRecords (params) {
  const resposne = await axios.post(FILE_DETAIL_SHARE_OPERATE_RECORDS_URL, params);
  return resposne;
}

async function viewShare (params) {
  const response = await axios.post(SHARE_VIEW, params);
  return response;
}

async function deleteFlie (params) {
  const response = await axios.post(FILE_DELETE_URL, { s: params });
  return response;
}

async function refreshFlie (params) {
    const response = await axios.post(FILE_REFRESH_URL, { s: params });
    return response;
}

async function getFile (params) {
    const response = await axios.post(FILE_FIND, params);
    return response;
}

async function getShareStatus (id) {
  const response = await axios.post(SHARE_STATUS, { s: id });
  return response;
}

async function getVertionActive (id) {
  const response = await axios.post(VERTION_ACTIVE, { s: id });
  return response;
}
async function getCompanyType() {
  const response=await axios.get(COMPANY_TYPE);
  return response;
}

async function getPatenerType() {
  const response=await axios.get(PARTNER_TYPE);
  return response;
}

async function getAccountType() {
  const response=await axios.get(ACCOUNT_TYPE);
  return response;
}

async function getWorkProcess() {
  const response=await axios.get(WORK_PROESS);
  return response;
}

async function getStatusList() {
  const response=await axios.get(STATUS_LIST);
  return response;
}

async function getqueryList (params) {
  const response = await axios.post(QUERY_MAIN, params);
  return response;
}

async function addManage (params) {
  const response = await axios.post(ADD_MANAGE, params);
  return response;
}


export default {
  getFileList,
  addFileOrFolder,
  batchUploadFile,
  getDetailInfo,
  modifyFile,
  getVersionList,
  addVersion,
  getFileByVersion,
  deleteVersion,
  addShare,
  getShareList,
  modifyShare,
  deleteShare,
  getWeappQRCode,
  getComments,
  addComment,
  getShareListOfSpecifiedFile,
  getOperateRecords,
  viewShare,
  deleteFlie,
  refreshFlie,
  getFile,
  getShareStatus,
  getVertionActive,
  getCompanyType,
  getPatenerType,
  getAccountType,
  getWorkProcess,
  getStatusList,
  getqueryList,
  addManage,
};
